include('https://js-dirav.googlecode.com/svn/trunk/js/hoverSprite.js');
include('https://js-dirav.googlecode.com/svn/trunk/js/googleMap.js');
include('https://js-dirav.googlecode.com/svn/trunk/js/slider.js');
include('https://js-dirav.googlecode.com/svn/trunk/js/jcarousellite_1.0.1.min.js');
include('https://js-dirav.googlecode.com/svn/trunk/js/cScroll.js');


//----Include-Function----
function include(url){ 
  document.write('<script src="'+ url + '" type="text/javascript" ></script>'); 
}
//--------global-------------
var isSplash = true;
var isGall = false;
//------DocReady-------------
$(document).ready(function(){ 
    if(location.hash.length == 0){
      //  location.hash="!/"+$('#content > ul > li:first-child').attr('id');
    }
    
     $('ul#menu').superfish({
          delay:       800,
          animation:   {height:'show'},
          speed:       600,
          autoArrows:  false,
         dropShadows: false
        });

});
  
 //------WinLoad-------------  
$(window).load(function(){  
    if ($("#img_slider").length) {
        $(function() {
            $("#img_slider").jCarouselLite({
                btnNext: ".nextIcon",
                btnPrev: ".prevIcon",
                speed: 800,
                visible: 7
            });
  
        });
};
    
    $('.scroll1').cScroll({
		duration:700,
		step:100,
		showTrack:false
	})
    
   	$('.Btns1 > .upBtn').click(function(){
 			$('.scroll1').cScroll('up');
 			return false
 		})
 	$('.Btns1 > .downBtn').click(function(){
 			$('.scroll1').cScroll('down');
 			return false
 		})
////////////////////////////////
    $('.scroll2').cScroll({
		duration:700,
		step:100,
		showTrack:false
	})
    
   	$('.Btns2 > .upBtn').click(function(){
 			$('.scroll2').cScroll('up');
 			return false
 		})
 	$('.Btns2 > .downBtn').click(function(){
 			$('.scroll2').cScroll('down');
 			return false
 		})
  ////////////////////////////////
    $('.scroll3').cScroll({
		duration:700,
		step:100,
		showTrack:false
	})
    
   	$('.Btns3 > .upBtn').click(function(){
 			$('.scroll3').cScroll('up');
 			return false
 		})
 	$('.Btns3 > .downBtn').click(function(){
 			$('.scroll3').cScroll('down');
 			return false
 		})


$(".followHolder > ul > li > a").hoverSprite({onLoadWebSite: true});

$(".upBtn").hoverSprite({onLoadWebSite: true});
$(".downBtn").hoverSprite({onLoadWebSite: true});

$(".prevIcon").hoverSprite({onLoadWebSite: true});
$(".nextIcon").hoverSprite({onLoadWebSite: true});

$("#buttonPrev").hoverSprite({onLoadWebSite: true});
$("#buttonNext").hoverSprite({onLoadWebSite: true});

$(".closeButton").hoverSprite({onLoadWebSite: true});



$('.zoomBack').stop().fadeTo(0, 0);
$('.zoomBack').hover(
    function(){
        $(this).stop().fadeTo(200, 0.5);
    },
    function(){
        $(this).stop().fadeTo(200, 0);
    }
)





    var navItems = $('.menu > ul >li');
    var _delay;

	var content=$('#content'),
		nav=$('.menu');

    	$('#content').tabs({
		preFu:function(_){
			_.li.css({top:"0px", height:"0px"});
		}
        
		,actFu:function(_){			
			if(_.curr){
				_.curr.css({top:"0px"}).stop().delay(100).animate({height:"487px"},800,'easeInOutCubic');
                
               
                  if ((_.n == 3) && ((_.pren!==3) || (_.pren==undefined))){
                        splashMode();
                    }

                if (((_.pren == 3) || (_.pren == undefined)) && (_.n!==3) ){
                    contentMode();
                    }
            }
        
            
			if(_.prev){
			     _.prev.stop().animate({top:"487px", height:"0px"},800,'easeInOutCubic');
             }
   
		}
	})
    

    function splashMode(){
        $("#splashHolder").css({'display':'block'}).stop().animate({opacity:1},500, 'easeInOutCubic');

    }
    
    function contentMode(){  
        $("#splashHolder").stop().animate({opacity:0},500, 'easeInOutCubic',function(){
            $(this).css({'display':'none'})
        })
    }
 
$('.gallBox').stop().animate({'opacity':0},0);    
$('.gallBox').css({"display":"none"});
  



$('.moreLink') .click(
    function(){
         isGall = false;
        $('.gallBox').stop().animate({'opacity':0},500,function(){$(this).css({"display":"none"}); })
    }
) 
   


$('.closeButton') .click(
    function(){
        isGall = false;
        $('.gallBox').stop().animate({'opacity':0},500,function(){$(this).css({"display":"none"}); })
    }
) 
   
   $(window).bind( 'hashchange', function(e) {
        if(isGall == true){
                $('.gallBox').stop().animate({'opacity':0},500,function(){$(this).css({"display":"none"}); })
        }
   });
   
    
	nav.navs({
			useHash:true,
            defHash: '#!/pageProjects',
             hoverIn:function(li){
                $(".menuText", li).stop().animate({color:'#c6c6c6'},500,'easeOutExpo');
             },
                hoverOut:function(li){
                     if ((!li.hasClass('with_ul')) || (!li.hasClass('sfHover'))) {
                        $(".menuText", li).stop().animate({color:'#2b2b2b'},500,'easeOutExpo'); 
                     }
                } 
		})
        
        
		.navs(function(n){			
			$('#content').tabs(n);
		})
  ///////////Resize////////////////////  
    

//////////////////////////////////////////
   	var h_cont=700;
	function centrRepos() {
		var h=$(window).height();
		if (h>(h_cont+40)) {
			m_top=~~(h-h_cont)/2;
			h_new=h;
		} else {
			m_top=20;
			h_new=h_cont+40;
		}
		$('.center').stop().animate({paddingTop:m_top},800,'easeOutExpo');
		//$('.main').css({height:h_new});
	}
	centrRepos();
    ///////////Window resize///////
	$(window).resize(function(){
                centrRepos()
                
            }
    );

    } //window function
) //window load